/**
 * 
 */
package mapreduce4j;

import org.apache.hadoop.io.WritableComparable;



/**
 * The context passed to the reducer
 * @author tim
 */
public abstract class ReducerContext<KEY_IN extends WritableComparable, VALUE_IN extends WritableComparable, KEY_OUT extends WritableComparable,VALUE_OUT extends WritableComparable> {
	protected RecordWriter<KEY_OUT, VALUE_OUT> output;
	protected KeyValuesIterator<KEY_IN, VALUE_IN> input;
	
	public ReducerContext(KeyValuesIterator<KEY_IN, VALUE_IN> input) {
		this.input = input;
	}

	public void write(KEY_OUT key, VALUE_OUT value) {
			System.out.println(key + ": " + value);
			//output.write(key, value);
	}

	public boolean nextKey() {
		return input.nextKeyValues();
	}

	public Iterable<VALUE_IN> getValues() {
		return input.currentValues;
	}

	public KEY_IN getCurrentKey() {
		return input.getCurrentKey();
	}
	
	/**
	 * Logs the status
	 * @param status to log
	 */
	public void setStatus(String status) {
		//log.info(status);
	}
	
}
